package be.jabapage.snooker.service.competition.api;

import java.util.Set;

import be.jabapage.snooker.exception.EntityNotFoundException;
import be.jabapage.snooker.exception.MultipleInstanceFoundException;
import be.jabapage.snooker.jdo.competition.TeamCompetitionParticipation;

/**
 * 
 * CRUD service for the ClubCompetitionParticipation
 * @author axesq
 *
 */
public interface ITeamCompetitionParticipationService {

	/**
	 * 
	 * Store or update a ClubCompetitionParticipation in the data store
	 * @param ClubCompetitionParticipation
	 */
	void store(TeamCompetitionParticipation clubCompetitionParticipation);

	/**
	 * Retrieve a ClubCompetitionParticipation by the key
	 * @param key
	 * @return ClubCompetitionParticipation
	 * @throws EntityNotFoundException when no record is found
	 */
	TeamCompetitionParticipation retrieve(Long key) throws EntityNotFoundException;

	/**
	 * Delete the instance with this key from the datastore.
	 * @param key
	 * @throws EntityNotFoundException when the instance is not found;
	 */
	void delete(Long key) throws EntityNotFoundException;

	/**
	 * Retrieves a set of ClubCompetitionParticipation that belongs to a certain competition.
	 * @param competitionId
	 * @return
	 */
	Set<TeamCompetitionParticipation> retrieveAllForSubCompetition(Long subCompetitionId);

	/**
	 * Retrieves a set of ClubCompetitionParticipation that belongs to a certain team.
	 * @param competitionId
	 * @return
	 */
	Set<TeamCompetitionParticipation> retrieveAllForTeam(Long teamId);

	/**
	 * Retrieves a set of ClubCompetitionParticipation that belongs to a certain team and season.
	 * @param competitionId
	 * @return
	 * @throws EntityNotFoundException 
	 * @throws MultipleInstanceFoundException 
	 */
	TeamCompetitionParticipation search(Long teamId, String season) throws EntityNotFoundException, MultipleInstanceFoundException;

}
